<?php
$params = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/params.php')
);
$config = [
    'id' => 'app-frontend',
    'name'  => 'gsz frontend',
    'defaultRoute' =>'index',
    'controllerNamespace'=>'frontend\controllers',
    'basePath'  => dirname(__DIR__),
    'bootstrap' => ['log'],
    'runtimePath' => RUNTIME_PATH,
    'language' => 'zh-CN',
    'params' => $params,
    'modules' => [
        'gii'=>[
            'class' => 'yii\gii\Module',
            'allowedIPs' => ['*'],
        ],
        'debug'=>[
            'class' => 'yii\debug\Module',
            'allowedIPs' => ['*']
        ],
        'oauth' => [
            'class' => 'frontend\modules\Oauth\Module',
        ],
        'user' => [
            'class' => 'frontend\modules\User\Module',
        ],
        'api' => [
            'class' => 'frontend\modules\Api\Module',
        ],
    ],
    'components' => [
        'assetManager' => [
            'class' => 'yii\web\AssetManager',
            'basePath' => __DIR__ . '/../web/assets',
            'forceCopy' => true,
            'appendTimestamp' => false,
        ],
//        'errorHandler' => [
//            'errorAction' => 'site/error',
//        ],
        'request' => [
            'csrfParam' => '_csrf-frontend',
            'cookieValidationKey' => 'ZYgmfltl7rFow5RYiKf6vgDTxOV9gJD_',
            // json请求自动解析
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
                'text/json' => 'yii\web\JsonParser',
            ],
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,  //启用路由
            'showScriptName' => false,  //false为隐藏 index.php
            'rules' => [
                'login'=>'index/login',
                'loginvercode'=>'index/loginvercode',
                'forgetpass'=>'index/forgetpass',
                'logout'=>'index/logout',
                'register'=>'index/register',
                'tally'=>'index/tally',
                'product'=>'index/product',
                'download'=>'index/download',
                'about'=>'index/about',
                'personal'=>'index/personal',
                'tallyList'=>'index/tally-list',
                'contact'=>'index/contact',
                'income'=>'index/income',
                'expend'=>'index/expend',
                'transfer'=>'index/transfer',
                'help'=>'index/help',
                'appdown'=>'index/appdown',
                'dz'=>'index/dz',
                'privacystatement'=>'index/privacystatement',
            ]
        ],
        'user' => [
            'class' =>'yii\web\User',
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                'error' => [
                    'logFile' => '@runtime/logs/frontend.error.log',
                ],
                'warning' => [
                    'logFile' => '@runtime/logs/frontend.warning.log',
                ],
                'info' => [
                    'logFile' => '@runtime/logs/frontend.info.log',
                ]
            ],
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
            'cachePath' => '@runtime/cache2',
        ]
    ]
];
return $config;
